<?php /* Smarty version 2.6.27, created on 2019-11-06 12:59:31
         compiled from server/edit.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 't', 'server/edit.tpl', 13, false),)), $this); ?>
<style>
    .txt{margin-left:8px;margin-right:2px;}
</style>

<form method="post" id="server_edit_form" action="admin.php?ctrl=server&act=submit&type=edit">
<table class="itable">
    <tr>
        <td width="50%" valign="top">
            <h3>基础信息</h3>
            <table class="itable itable-color">
                <input value="<?php echo $this->_tpl_vars['server']['id']; ?>
" name="id" style="display:none"/>
                <tr>
                    <th><?php echo ((is_array($_tmp='区服ID')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td><input type="text" value="<?php echo $this->_tpl_vars['server']['server_id']; ?>
" name="server_id" onkeyup="setApi(this.value)"/></td>
                </tr>
                <tr>
                    <th><?php echo ((is_array($_tmp='合服ID')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td><input type="text" value="<?php echo $this->_tpl_vars['server']['merge_id']; ?>
" name="merge_id" onkeyup="setApi(this.value)"/></td>
                </tr>
                <tr>
                    <th><?php echo ((is_array($_tmp='名称')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <input type="text" value="<?php echo $this->_tpl_vars['server']['name']; ?>
" name="name"/>
                    </td>
                </tr>

                <tr>
                    <th><?php echo ((is_array($_tmp='状态')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <select name="status">
                             <?php $_from = $this->_tpl_vars['serverStatus']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['item']):
?>
                                <option value="<?php echo $this->_tpl_vars['key']; ?>
" <?php if ($this->_tpl_vars['server']['status'] == $this->_tpl_vars['key']): ?>selected<?php endif; ?> ><?php echo $this->_tpl_vars['item']; ?>
</option>
                            <?php endforeach; endif; unset($_from); ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th><?php echo ((is_array($_tmp='游戏版本')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <input type="text" value="<?php echo $this->_tpl_vars['server']['game_version']; ?>
" name="game_version"/>
                    </td>
                </tr>


                <tr>
                    <th><?php echo ((is_array($_tmp='开服时间')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <input type="text" value="<?php echo $this->_tpl_vars['server']['open_time']; ?>
" name="open_time" class="datepicker"/>
                    </td>
                </tr>
                <tr>
                    <th><?php echo ((is_array($_tmp='关服时间')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <input type="text" value="<?php echo $this->_tpl_vars['server']['close_time']; ?>
" name="close_time" class="datepicker"/>
                    </td>
                </tr>
                <tr>
                    <th><?php echo ((is_array($_tmp='服务器IP')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <input type="text" value="<?php echo $this->_tpl_vars['server']['server_ip']; ?>
" name="server_ip" />
                    </td>
                </tr>
                <tr>
                    <th><?php echo ((is_array($_tmp='服务器端口')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <input type="text" value="<?php echo $this->_tpl_vars['server']['server_port']; ?>
" name="server_port" />
                    </td>
                </tr>
                <tr>
                    <th><?php echo ((is_array($_tmp='渠道')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                    <td>
                        <select name="channel">
                                <option value=""> --请选择-- </option>
                            <?php $_from = $this->_tpl_vars['channel']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
                                <option value="<?php echo $this->_tpl_vars['item']['flag']; ?>
" <?php if ($this->_tpl_vars['server']['channel'] == $this->_tpl_vars['item']['flag']): ?> selected = selected <?php endif; ?> > <?php echo $this->_tpl_vars['item']['name']; ?>
 </option>
                            <?php endforeach; endif; unset($_from); ?>
                        </select>

                    </td>
                </tr>
            </table>
        </td>

        <td valign="top">
            <?php if ($this->_tpl_vars['purview_database_setting'] == 1): ?>
                <h3>数据库</h3>
                <table class="itable itable-color">
                    <tr>
                        <th><?php echo ((is_array($_tmp='mysql主机')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                        <td><input type="text" value="<?php echo $this->_tpl_vars['server']['mysql_host']; ?>
" name="mysql_host" onkeyup="setApi(this.value)"/></td>
                    </tr>


                    <tr>
                        <th><?php echo ((is_array($_tmp='mysql端口')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                        <td>
                            <input type="text" value="<?php echo $this->_tpl_vars['server']['mysql_port']; ?>
" name="mysql_port"/>
                        </td>
                    </tr>
                    <tr>
                        <th><?php echo ((is_array($_tmp='mysql用户名')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                        <td>
                            <input type="text" value="<?php echo $this->_tpl_vars['server']['mysql_user']; ?>
" name="mysql_user"/>
                        </td>
                    </tr>
                    <tr>
                        <th><?php echo ((is_array($_tmp='mysql密码')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                        <td>
                            <input type="password" value="<?php echo $this->_tpl_vars['server']['mysql_passwd']; ?>
" name="mysql_passwd"/>
                        </td>
                    </tr>

                    <tr>
                        <th><?php echo ((is_array($_tmp='actor 数据库名')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                        <td>
                            <input type="text" value="<?php echo $this->_tpl_vars['server']['actor_table']; ?>
" name="actor_table"/>
                        </td>
                    </tr>
                    <tr>
                        <th><?php echo ((is_array($_tmp='log 数据库名')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</th>
                        <td>
                            <input type="text" value="<?php echo $this->_tpl_vars['server']['log_table']; ?>
" name="log_table"/>
                        </td>
                    </tr>
                </table>
            <?php endif; ?>

            <input type="submit" class="gbutton" id="save" value="<?php echo ((is_array($_tmp='保存')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
" />
        </td>
    </tr>
</table>
</form>


<script type="text/javascript">
 function setApi(ip) {
     $('#api').val("http://" + ip + '/hhsy/single/api.php')
 }

var timepickerlang =
{timeText: '<?php echo ((is_array($_tmp='时间')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
',
    hourText: '<?php echo ((is_array($_tmp='小时')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
',
    minuteText: '<?php echo ((is_array($_tmp='分钟')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
',
    currentText: '<?php echo ((is_array($_tmp='现在')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
',
    closeText: '<?php echo ((is_array($_tmp='确定')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
'}
$('.datepicker').datetimepicker(timepickerlang);

$('#server_edit_form').ajaxForm({
	beforeSend: function() {
        var server_id = $('input[name="server_id"]').val();
        if(server_id == ""){
        	$.dialog.alert('服务器ID不能为空');
            return false;
        }
        $('#save').val("提交中...")
        $('#save').prop('disabled', true)
    },
    complete: function(xhr) {
        $('#save').val("保存")
        $('#save').prop('disabled', false)
        var msg = xhr.responseText;//JSON.parse();
        if (msg == 1)
            $tabs.tabs('select',0);
        else
            $.dialog.alert(msg);
    }
});
</script>